﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;

namespace ClassForWinForm
{
    public partial class Form11 : Form
    {
        public Form11()
        {
            InitializeComponent();
        }

        private void Form11_Load(object sender, EventArgs e)
        {
            ImageList imgList = new ImageList();
            imgList.ImageSize = new Size(150, 150);
            imgList.Images.Add(Bitmap.FromFile(@"G:\MyFile\pic\1.png"));
            imgList.Images.Add(Bitmap.FromFile(@"G:\MyFile\pic\2.png"));

            
            this.listView1.LargeImageList = imgList;
            for (int i = 1; i < 11; i++)
            {
                ListViewItem lvi = new ListViewItem();

                lvi.ImageIndex = 0;
                lvi.Tag = "空桌";
                if (i < 5)
                {
                    lvi.ImageIndex = 1;
                    lvi.Tag = "使用中";
                }
                lvi.Text = i+"号桌";
                

                this.listView1.Items.Add(lvi);
            }
        }
        private void listView1_Click(object sender, EventArgs e)
        {
            string Text = listView1.FocusedItem.Text;
            MessageBox.Show(Text);
        }
    }
}
